#!/usr/bin/node

const log = console.log,
      fs = require('fs'),
      src = process.argv[2],
      mod = process.argv[3];

if(process.argv.length !== 4){
  log('Incorrect command line parameters!');
  process.exit(2);
}
//./15-mod.js src mod

try{

  fs.chmodSync(src,parseInt(mod,8));

}catch(e){
  console.error(e.message);
  process.exit(1);
}
